import request from "@/utils/request";
import type { UserLoginRequestDTO, UserLoginResponseDTO } from "./sysAuthType";

enum URL {
    URL_AUTH_BASE = '/auth',
    URL_AUTH_LOGIN = URL_AUTH_BASE + '/login',
    URL_AUTH_LOGOUT = URL_AUTH_BASE + '/logout'
}

/**
 * 用户登录
 * @param userInfo  用户信息
 * @returns 
 */
export const login = (userInfo: UserLoginRequestDTO):
    Promise<UserLoginResponseDTO> =>
    request.post(URL.URL_AUTH_LOGIN, userInfo)

/**
 * 用户退出登录
 * @returns 
 */
export const logout = ():
    Promise<UserLoginResponseDTO> =>
    request.post(URL.URL_AUTH_LOGOUT)